<script setup>
/**
 * 联系人列表中的用户展示Box 可以点击跳转到聊天界面
 * 我的联系人
 */
import { useInChatContactInfStore } from '@/stores/useInChatContactInfStore.js'
const inChatContactInfStore = useInChatContactInfStore()

const props = defineProps({
    headImgUrl: {
        type: String,
        default: '',
    },
    username: {
        type: String,
        default: '加载中...',
    },
    id: {
        type: Number,
        default: '',
    },
})

const changeInChatContact = () => {
    inChatContactInfStore.id = props.id
    inChatContactInfStore.headImgUrl = props.headImgUrl
    inChatContactInfStore.username = props.username
}
</script>

<template>
    <div class="box" @click="changeInChatContact">
        <img :src="headImgUrl" alt="" />
        <div style="font-size: 20px; line-height: 80px">{{ username }}</div>
    </div>
</template>

<style scoped>
.box {
    position: relative;
    height: 80px;
    width: 100%;
    border-bottom: 1px solid var(--el-border-color);
    display: flex;
}

img {
    width: 62px;
    height: 62px;
    margin: 9px;
    border-radius: 12px;
}
</style>
